package com.designpatterns.behavioral.facade.imp;

import com.designpatterns.behavioral.facade.CipherMachine;
import com.designpatterns.behavioral.facade.FileReader;
import com.designpatterns.behavioral.facade.FileWriter;

public class NewEcryptFacade extends AbstractEncryptFacade {

    private FileReader reader;
    private NewCipherMachine cipher;
    private FileWriter writer;

    public NewEcryptFacade() {
        this.reader = new FileReader();
        this.cipher = new NewCipherMachine();
        this.writer = new FileWriter();
    }

    //调用子系统对象的业务方法
    public void fileEncrypt(String fileNameSrc,String fileNameDes){
        String plainStr = reader.read(fileNameSrc);
        String encryptStr = cipher.encrypt(plainStr);
        writer.write(encryptStr,fileNameDes);
    }
}
